#!/usr/bin/env python 
#+_+ coding:utf-8 +_+

import httplib
import hashlib

def md5(*args):
    md5Ctx = hashlib.md5()
    for arg in args:
        md5Ctx.update(str(arg))
    return md5Ctx.hexdigest()


httpClient = httplib.HTTPConnection('42.96.192.37', 8080, timeout=30)  

uid = 1
newsID = 1
ticket   = "bd637611abfe504f1ad40547af91687f"

contents = [str(uid),str(newsID),ticket]
contents = sorted(contents)
signature = md5(*contents)


params = dict(uid=uid,signature=signature,newsID=newsID)

req="/apping/demo/comment?uid={uid}&&signature={signature}&&news_id={newsID}".format(**params)

httpClient.request('GET', req)  
  
response = httpClient.getresponse()  
print response.status  
print response.reason  
print response.read()
